﻿using System.Data;
using System.Data.SqlClient;


namespace WebApplication1
{
    public class DbHelper
    {
        private static readonly string KaiYe = "server = .;database=luoxuan;uid=sa;pwd=123456;";

        public static DataTable GetData(string sql)
        {
            SqlDataAdapter adapter = new SqlDataAdapter(sql, KaiYe);
            DataTable data = new DataTable();
            adapter.Fill(data);
            return data;
        }

        public static int SenYe(string sql)
        {
            SqlConnection connection = new SqlConnection(KaiYe);
            SqlCommand command = new SqlCommand(sql, connection);
            connection.Open();
            int YueGe = command.ExecuteNonQuery();
            connection.Close();
            return YueGe;
        }
    }
}